import { Controller } from 'egg';
import { IHttpPostData } from '../../typings';

export default class ApiController extends Controller {
  public async getQueries() {
    const { ctx } = this;

    //拿到客户端传入的请求参数
    const { subject, model }: IHttpPostData = ctx.request.body;

    //调用service向聚合数据API发起HTTP请求,响应中间层数据给客户端
    ctx.body = await ctx.service.api.getQueries({
      subject,
      model
    });
  }
}
